<?php 
/*
Template Name: Theses
*/
get_header(); ?>

<hr />

<div id="wrapper">
<div id="content">

<h2>Theses</h2>
<?php 
//Faccio la query per ritornare il custom post type "thesis"
			$type = 'thesis';
			$args=array(
				'post_type' => $type,
				'post_status' => 'publish',
				'paged' => $paged,
				'posts_per_page' => 10,
				'caller_get_posts'=> 1
			);
			$wp_query = null;
			$wp_query = new WP_Query($args);
			
		?>

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

<?php 
	$class = 'post_custom';
	$status = '';
	$assigned = get_post_meta(get_the_ID(),'Assigned', true);	
	if ($assigned) {
		$class = 'thesis_assigned';
		$status = '(Assigned)';
	}
?>

<div class="<?php echo $class; ?>" id="post-<?php the_ID(); ?>">

	 <h3 class="storytitle"><?php the_title(); ?> <?php echo $status; ?> </h3>
<!--	<div class="meta"><span class="user"><?php the_author() ?> @ <?php the_time() ?></span> <?php edit_post_link(__('Edit This')); ?></div>
-->
	<div class="storycontent">
		<?php the_content(__('(more...)')); ?>
	</div>

</div>

<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>

<?php posts_nav_link(' &#8212; ', __('&laquo; Previous Page'), __('Next Page &raquo;')); ?>

<?php get_footer(); ?>